package com.cskaoyan.mall.product.controller;

import com.cskaoyan.mall.common.result.Result;
import com.cskaoyan.mall.product.dto.ProductDetailDTO;
import com.cskaoyan.mall.product.service.ProductDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Macro_Ray
 * @since 2024/6/12 下午9:39
 */
@RestController
public class ProductDetailController {

    @Autowired
    ProductDetailService productDetailService;

    @GetMapping("/goods/{skuId}")
    public Result<ProductDetailDTO> getProductDetail(@PathVariable("skuId") Long skuId) {
        ProductDetailDTO pdBySkuId = productDetailService.getPDBySkuId(skuId);
        return Result.ok(pdBySkuId);
    }
}
